﻿#include "UAlarm.h"
#include <QFile>
#include "Global.h"
#include <QDebug>
#include <QtConcurrent/QtConcurrentRun>
#include "CBaseDevice.h"
#include "CSqlOper.h"
UAlarm::UAlarm(QWidget *parent)
	: QWidget(parent)
{
	QFile filePage(":/SmartControl/Qss/card.qss"); // 资源路径
	QString sStaly = "";
	if (filePage.open(QFile::ReadOnly))
	{
		sStaly = filePage.readAll();
		filePage.close();
	}
	ui.setupUi(this);
	setWindowModality(Qt::ApplicationModal);
	initUi();
	m_pAlarmDetailsDlg = nullptr;
	//setStyleSheet(sStaly);
}

UAlarm::UAlarm(QPushButton* pBtn, int nType, QWidget* parent)
{
	initColor();
	m_pBtn = pBtn;
	m_nType = nType;
	QFile filePage(":/SmartControl/Qss/card.qss"); // 资源路径
	QString sStaly = "";
	if (filePage.open(QFile::ReadOnly))
	{
		sStaly = filePage.readAll();
		filePage.close();
	}
	ui.setupUi(this);
	initUi();
	m_bInit = false;
	m_nRefushTableIndex = 0;
	m_nToggleTimer = -1;
	m_pAlarmDetailsDlg = nullptr;
}

UAlarm::~UAlarm()
{
	resetData();
}

void UAlarm::initData()
{
	//初始化数据
	resetData();
	if (m_nType == 0)
	{
		//1.获取所有测点列表 m_vecAlarm 然后插入m_mapAlarm
		m_vecAlarm = getTechAlarmPoint();
		for (int i = 0; i < m_vecAlarm.size(); i++)
		{
			QString sDevName = m_vecAlarm[i]->getParent()->getParent()->getName() + "." + m_vecAlarm[i]->getParent()->getName();
			QString sPointName = sDevName + "." + m_vecAlarm[i]->getName();
			if (!m_mapAlarm.contains(sPointName))
			{
				m_mapAlarm.insert(sPointName, m_vecAlarm[i]);
			}
		}
		//2.赋值给m_mapAlarmInsert 然后判断数据库里面有没有 如果有从m_mapAlarmInsert里面移除
		m_mapAlarmInsert = m_mapAlarm;
		//3.数据库里面查到有两部分 一部分是设备测点  还有一部分是人员定位SOS测点
		getDbPointInfo();
		QMap<QString, CAlarmPoint*>mapAlarmInsert = m_mapAlarmInsert;
		//4.开一个子线程 插入测点到数据库
		QtConcurrent::run([mapAlarmInsert]()
			{
				for (auto it = mapAlarmInsert.begin(); it != mapAlarmInsert.end(); it++)
				{
					QVector<QString>vecData;
					QString sGuid = it.value()->getParent()->getParent()->getId() + it.value()->getParent()->getId() + it.value()->getId();
					vecData.push_back(sGuid);
					vecData.push_back(it.value()->getValType());
					vecData.push_back(it.value()->getParent()->getParent()->getId());
					vecData.push_back(it.value()->getParent()->getParent()->getName());
					CBaseDevice* pDev = (CBaseDevice*)it.value()->getParent();
					vecData.push_back(QString::number(pDev->getDeviceType()));
					vecData.push_back(it.value()->getParent()->getId());
					vecData.push_back(it.value()->getParent()->getName());
					vecData.push_back(it.value()->getId());
					vecData.push_back(it.value()->getName());
					vecData.push_back(QString::number(static_cast<int>(it.value()->getAlarmConfirmStatus())));
					vecData.push_back(QString::number(it.value()->getValue().toDouble()));
					vecData.push_back("");
					vecData.push_back(it.value()->getLastUpdateTime().toString("yyyy-MM-dd HH:mm:ss"));
					vecData.push_back(it.value()->getFileRef());
					vecData.push_back("");
					vecData.push_back("");
					vecData.push_back("");
					vecData.push_back("");
					vecData.push_back(it.value()->getUnit());
					QString sErr = "";
					insertPointInfo(vecData,sErr);
					QThread::msleep(50);
				}
			});
		//5.创建人员定位SOS测点  内蒙古定制化
		createSosPoint();
	}
	else
	{
		m_vecAlarm = getFaultAlarmPoint();
	}
}

//重置所有数组数据
void UAlarm::resetData()
{
	m_vecAlarm.clear();
	m_vecDb.clear();
	m_vecCreatePoint.clear();
	m_mapAlarm.clear();
	m_mapAlarmInsert.clear();
	for (int i = 0; i < m_vecSos.size(); i++)
	{
		m_vecSos[i]->getParent()->getParent()->deleteLater();
	}
	m_vecSos.clear();
	m_mapSos.clear();
}

void UAlarm::startRufush()
{
	if (m_nToggleTimer > 0)
	{
		return;
	}
	m_nToggleTimer = startTimer(800);
	m_bInit = false;
}

void UAlarm::stopRufush()
{
	if (m_nToggleTimer <= 0)
	{
		return;
	}
	killTimer(m_nToggleTimer);
	m_nToggleTimer = 0;
}

void UAlarm::rufushPoint()
{
	m_bInit = false;
}

void UAlarm::initUi()
{
	connect(ui.pushButton_AllSure, SIGNAL(clicked()), this, SLOT(slotAllSure()));
	connect(ui.pushButton_Sure, SIGNAL(clicked()), this, SLOT(slotSure()));
	connect(ui.pushButton_Cancel, SIGNAL(clicked()), this, SLOT(slotCancel()));
	connect(ui.pushButton_Show, SIGNAL(clicked()), this, SLOT(slotShow()));
	connect(ui.Btn_Close, SIGNAL(clicked()), this, SLOT(slotClose()));
	ui.tableWidget->verticalHeader()->setVisible(false);
	ui.tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);  // 设置整行选中
	ui.tableWidget->setSelectionMode(QAbstractItemView::SingleSelection); // 单行选择
	ui.tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);   // 禁用编辑	
	ui.tableWidget->setColumnCount(7);
	QStringList headers;
	headers << A2T("序号") << A2T("设备名称") << A2T("测点名称") << A2T("时间") << A2T("值") << A2T("报警等级") << A2T("报警描述");
	ui.tableWidget->setHorizontalHeaderLabels(headers);
}




//刷新报警测点数据和表格 
void UAlarm::refushTable()
{
	m_vecCurrAlarm.clear();
    //刷新表格
	for (int i = 0; i < m_vecAlarm.size(); i++)
	{		
		if (m_vecAlarm[i]->getAlarmConfirmStatus() != EAlarmConfirmStatus::enNormal)
		{
			m_vecCurrAlarm.push_back(m_vecAlarm[i]);
		}
	}
	for (int i = 0; i < m_vecSos.size(); i++)
	{
		if (m_vecSos[i]->getAlarmConfirmStatus() != EAlarmConfirmStatus::enNormal)
		{
			m_vecCurrAlarm.push_back(m_vecSos[i]);
		}
	}
	ui.tableWidget->clearContents(); // 清空现有内容
	ui.tableWidget->setRowCount(0);  // 如果你要把行全部删掉（可选）
	// 设置行数
	int rowCount = m_vecCurrAlarm.size();
	ui.tableWidget->setRowCount(rowCount);
	for (int i = 0; i < rowCount; i++)
	{
		QTableWidgetItem* pItem1 = new QTableWidgetItem(QString::number(i));
		QTableWidgetItem* pItem2 = new QTableWidgetItem(m_vecCurrAlarm[i]->getParent()->getName());
		QTableWidgetItem* pItem3 = new QTableWidgetItem(m_vecCurrAlarm[i]->getName());
		QTableWidgetItem* pItem4 = new QTableWidgetItem(m_vecCurrAlarm[i]->getAlarmTime().toString("yyyy-MM-dd HH:mm:ss"));
		QTableWidgetItem* pItem5 = new QTableWidgetItem(QString::number(m_vecCurrAlarm[i]->getValue().toDouble(), 'f', 2));
		QString sAlarmLevel = A2T("一级");
		QString sAlarmLevelDesc = A2T("报警消失未确认");
		if (m_vecCurrAlarm[i]->getAlarmLevel() == EAlarmLevel::enLow || m_vecCurrAlarm[i]->getAlarmLevel() == EAlarmLevel::enHigh)
		{
			sAlarmLevel = A2T("一级");

		}
		else if (m_vecCurrAlarm[i]->getAlarmLevel() == EAlarmLevel::enHighHigh || m_vecCurrAlarm[i]->getAlarmLevel() == EAlarmLevel::enLowLow)
		{
			sAlarmLevel = A2T("二级");
		}
		else
		{
			sAlarmLevel = A2T("正常");
		}
		if (m_vecCurrAlarm[i]->getAlarmConfirmStatus() == EAlarmConfirmStatus::enAlarmPending)
		{
			m_nTechIndex++;
			sAlarmLevelDesc = A2T("报警产生未确认");
		}
		else if (m_vecCurrAlarm[i]->getAlarmConfirmStatus() == EAlarmConfirmStatus::enAlarmClearPending)
		{
			sAlarmLevelDesc = A2T("报警消失未确认");
		}
		else if (m_vecCurrAlarm[i]->getAlarmConfirmStatus() == EAlarmConfirmStatus::enAlarmConfirmed)
		{
			sAlarmLevelDesc = A2T("报警产生已确认");
		}
		QTableWidgetItem* pItem6 = new QTableWidgetItem(sAlarmLevel);
		QTableWidgetItem* pItem7 = new QTableWidgetItem(sAlarmLevelDesc);
		pItem1->setTextAlignment(Qt::AlignCenter);
		pItem2->setTextAlignment(Qt::AlignCenter);
		pItem3->setTextAlignment(Qt::AlignCenter);
		pItem4->setTextAlignment(Qt::AlignCenter);
		pItem5->setTextAlignment(Qt::AlignCenter);
		pItem6->setTextAlignment(Qt::AlignCenter);
		ui.tableWidget->setItem(i, 0, pItem1);                  // 序号
		ui.tableWidget->setItem(i, 1, pItem2);                  // 设备名称
		ui.tableWidget->setItem(i, 2, pItem3);                  // 检测对象名称
		ui.tableWidget->setItem(i, 3, pItem4);                  // 检测维度名称
		ui.tableWidget->setItem(i, 4, pItem5);                  // "时间
		ui.tableWidget->setItem(i, 5, pItem6);                  // 值
		ui.tableWidget->setItem(i, 6, pItem7);                  // 报警描述
	}
	ui.tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
	updateRowBackground();
	/*if (m_vecCurrAlarm.size() > 0)
	{
		if (m_pAlarmDetailsDlg == nullptr)
		{
			for (int i = 0; i < m_vecCurrAlarm.size(); i++)
			{
				if (m_vecCurrAlarm[i]->getAlarmConfirmStatus() == EAlarmConfirmStatus::enAlarmPending)
				{
					speechAlert(m_vecCurrAlarm[i]);
					m_pAlarmDetailsDlg = new CAlarmDetailsDlg(m_vecCurrAlarm[i]);
					m_pAlarmDetailsDlg->exec();
					break;
				}
			}
		}
		else
		{
			if (!m_pAlarmDetailsDlg->isVisible())
			{
				delete m_pAlarmDetailsDlg;
				m_pAlarmDetailsDlg = nullptr;
				for (int i = 0; i < m_vecCurrAlarm.size(); i++)
				{
					if (m_vecCurrAlarm[i]->getAlarmConfirmStatus() == EAlarmConfirmStatus::enAlarmPending)
					{
						speechAlert(m_vecCurrAlarm[i]);
						m_pAlarmDetailsDlg = new CAlarmDetailsDlg(m_vecCurrAlarm[i]);
						m_pAlarmDetailsDlg->exec();
						break;
					}
				}
			}
		}	
	}*/
}


void UAlarm::updateRowBackground()
{
	int nRowCount = ui.tableWidget->rowCount();
	for (int i = 0; i < m_vecCurrAlarm.size(); i++)
	{
		int nState= static_cast<int>(m_vecCurrAlarm[i]->getAlarmConfirmStatus());
		QColor cBackGround, cText;
		if (m_bToggle)
		{
			cText = m_mapShowColor[m_nType][nState].cText1;
			cBackGround = m_mapShowColor[m_nType][nState].cBackGround1;
		}
		else
		{
			cText =m_mapShowColor[m_nType][nState].cText2;
			cBackGround =m_mapShowColor[m_nType][nState].cBackGround2;
		}
		int nCol = ui.tableWidget->columnCount();
		for (int j = 0; j < nCol; j++)
		{
			QTableWidgetItem* item = ui.tableWidget->item(i, j);
			if (item)
			{
				item->setBackground(QBrush(cBackGround));  // 设置背景色
				item->setForeground(QBrush(cText));        // 设置字体颜色
			}
		}
	}

	/**
	* @ Author: Gaojia
	* @ Description: 按钮闪烁
	*/
	{
		int nAllState = 0;
		for (int i = 0; i < m_vecCurrAlarm.size(); i++)
		{
			int nState = static_cast<int>(m_vecCurrAlarm[i]->getAlarmConfirmStatus());
			nAllState = nAllState | nState;
			if (nAllState > 3)
				nAllState = 1;
		}
		QString sButtonStyle = "";
		if (m_bToggle)
		{
			sButtonStyle = m_mapShowColor[m_nType][nAllState].sButtenStyle1;
		}
		else
		{
			sButtonStyle =m_mapShowColor[m_nType][nAllState].sButtenStyle2;
		}
		m_pBtn->setStyleSheet(sButtonStyle);
	}
	m_bToggle = !m_bToggle;
}

void UAlarm::timerEvent(QTimerEvent* event)
{
	if (event->timerId() == m_nToggleTimer)
	{
		if (!m_bInit)
		{
			initData();
			m_bInit = true;
			return;
		}
		
		if (m_nRefushTableIndex > 6)
		{
			//刷新人员定位测点数据库里面状态有没有变化的
			refushSosPoint();
			//刷新报警测点状态有没有变化的
			refushPoint();

			refushTable();
			m_nRefushTableIndex = 0;
		}
		else
		{
			updateRowBackground();
			m_nRefushTableIndex++;
		}	
	}
}
void UAlarm::speechAlert(CAlarmPoint* pAlarmPoint)
{
	CSpeechAlert::SSpeechSet stSpeech;
	stSpeech.sId = "fixedOne";                   //可设置Id  不设置就会动生成一个
	stSpeech.nFixedNum = 5;                      //循环次数为3 播报3次后停止
	stSpeech.enType = CSpeechAlert::enFixed;     //播报类型为固定次数
	//stSpeech.nSpeechTimeLimit = 15000;               //设置播放时长限制 默认是0 播完即停止
	QString sNodeName = pAlarmPoint->getParent()->getName();
	QString sInfo = sNodeName + pAlarmPoint->getName()+ A2T("报警");
	//QString sInfo = cAlarmShowInfo.sDevName;
	stSpeech.sContent = sInfo;  //设置内容
	CSpeechAlert::getInstance()->speechNow(stSpeech);     //添加到队列 返回值是设置或自动生成Id
}
void UAlarm::getDbPointInfo()
{
	QString sErr = "";
	QVector<QVector<QString>>vecData = selPointInfo(sErr);
	if (vecData.size() > 0)
	{
		for (int i = 0; i < vecData.size(); i++)
		{
			QString sPointName = vecData[i][3] + "." + vecData[i][6]+"."+ vecData[i][8];
			//如果测点存在 就更新测点数据
			if (m_mapAlarm.contains(sPointName))
			{
				m_mapAlarmInsert.remove(sPointName);
				//用数据库数据 初始化测点数据
				//m_mapAlarm[sPointName]->setValue("");
			}
			//如果不存在就创建新的  目前只创建人员定位的
			else
			{
				if (vecData[i][4].toInt() == 5)
				{
					m_vecCreatePoint.push_back(vecData[i]);
				}

			}
		}
		
	}
}
void UAlarm::createSosPoint()
{
	for (int i = 0; i < m_vecCreatePoint.size(); i++)
	{
		CBaseNode* pNode = new CBaseNode(m_vecCreatePoint[i][2], m_vecCreatePoint[i][3]);
		CBaseDevice* pDevice = new CBaseDevice(m_vecCreatePoint[i][6], m_vecCreatePoint[i][5], "", pNode);
		CAlarmPoint* pPoint = new CAlarmPoint(m_vecCreatePoint[i][7], m_vecCreatePoint[i][8], pDevice, EPointType::enDigital, A2T("/"));
		m_vecSos.push_back(pPoint);
		QString sId = pNode->getId() + "." + pDevice->getId() + "." + pPoint->getId();
		pPoint->setAlarmDesc(m_vecCreatePoint[i][11]);
		m_mapSos.insert(sId, pPoint);
	}
}


void UAlarm::refushSosPoint()
{
	QString sErr = "";
	QVector<QVector<QString>>vecPoint = selPointInfoByType(5, sErr);

	for (int i = 0; i < vecPoint.size(); i++)
	{
		QString sId = vecPoint[i][2] + "." + vecPoint[i][5] + "." + vecPoint[i][7];
		if (m_mapSos.contains(sId))
		{
			m_mapSos[sId]->setAlarmConfirmStatus((EAlarmConfirmStatus)vecPoint[i][9].toInt());
			m_mapSos[sId]->setAlarmDesc(vecPoint[i][11]);
		}
	}
}

void UAlarm::refushPoint()
{
	QString sErr = "";
	for (int i = 0; i < m_vecAlarm.size(); i++)
	{
		if (m_vecAlarm[i]->getAlarmStateChange())
		{
			updataPointInfo(m_vecAlarm[i], sErr);
			m_vecAlarm[i]->setAlarmStateChange(false);
		}
	}
}

void UAlarm::slotAllSure()
{
	for (int i = 0; i < m_vecCurrAlarm.size(); i++)
	{
		m_vecCurrAlarm[i]->setAlarmConfirm();
		QString sErr = "";
		updataPointInfo(m_vecCurrAlarm[i], sErr);
		m_vecCurrAlarm[i]->setAlarmStateChange(false);
		QThread::msleep(100);
	}
	refushTable();
}



void UAlarm::slotSure()
{
	int nCurrentRow = ui.tableWidget->currentRow();
	if (nCurrentRow < 0)
	{
		showMessageBox(this, A2T("警告"), A2T("请选中一行进行确认！"), 1);
		return;
	}
	showMessageBox(this, A2T("提升"), A2T("报警确认成功！"), 1);
	m_vecCurrAlarm[nCurrentRow]->setAlarmConfirm();
	QString sErr = "";
	updataPointInfo(m_vecCurrAlarm[nCurrentRow], sErr);
	m_vecCurrAlarm[nCurrentRow]->setAlarmStateChange(false);
	refushTable();
}

void UAlarm::slotCancel()
{
	int nCurrentRow = ui.tableWidget->currentRow();
	if (nCurrentRow < 0)
	{
		showMessageBox(this, A2T("警告"), A2T("请选中一行进行确认！"), 1);
		return;
	}
	m_vecCurrAlarm[nCurrentRow]->setAlarmConfirmStatus(EAlarmConfirmStatus::enNormal);
	showMessageBox(this, A2T("提示"), A2T("报警取消成功！"), 1);
}

void UAlarm::slotShow()
{
	int nCurrentRow = ui.tableWidget->currentRow();
	if (nCurrentRow < 0)
	{
		showMessageBox(this, A2T("警告"), A2T("请选中一行进行确认！"), 1);
		return;
	}
	CAlarmDetailsDlg oper(m_vecCurrAlarm[nCurrentRow]);
	oper.exec();
}

void UAlarm::slotClose()
{
	close();
}

void UAlarm::initColor()
{
	QColor cColorRed(Qt::red);
	QColor cColorYellow(Qt::yellow);
	QColor cColorGreen(Qt::green);
	QColor cColorWrite(Qt::white);
	QColor cColorBlack(Qt::black);
	QVector<SShowColor> vecShowColor;
	/**
	* @ Author: Gaojia
	* @ Description:   状态0
	*/
	SShowColor cShowColor00;
	cShowColor00.cBackGround2 = cColorWrite;
	cShowColor00.cText2 = cColorBlack;
	cShowColor00.cBackGround1 = cColorWrite;
	cShowColor00.cText1 = cColorBlack;
	cShowColor00.sButtenStyle1 = "QPushButton {"
		"    background-color: rgb(0,255,0);"  // 背景色 (黄色)
		"    color: black;"               // 文字颜色 (黑色)
		"    border: none;"               // 去掉边框
		"    padding: 10px;"              // 内边距
		"    border-radius: 15px;"         // 圆角
		"}"
		"QPushButton:hover {"
		"    background-color: #e1e100;"  // 鼠标悬停时的背景色
		"}";
	cShowColor00.sButtenStyle2 = "QPushButton {"
		"    background-color: rgb(0,255,0);" // 背景色 (黄色)
		"    color: black;"               // 文字颜色 (黑色)
		"    border: none;"               // 去掉边框
		"    padding: 10px;"              // 内边距
		"    border-radius: 15px;"         // 圆角
		"}"
		"QPushButton:hover {"
		"    background-color: #e1e100;"  // 鼠标悬停时的背景色
		"}";
	/**
	* @ Author: Gaojia
	* @ Description:   工艺 状态1
	*/
	SShowColor cShowColor01;
	cShowColor01.cBackGround2 = cColorYellow;
	cShowColor01.cText2 = cColorBlack;
	cShowColor01.cBackGround1 = cColorYellow;
	cShowColor01.cText1 = cColorBlack;
	cShowColor01.sButtenStyle1 = "QPushButton {"
		"    background-color: yellow;"  // 背景色 (黄色)
		"    color: black;"               // 文字颜色 (黑色)
		"    border: none;"               // 去掉边框
		"    padding: 10px;"              // 内边距
		"    border-radius: 15px;"         // 圆角
		"}"
		"QPushButton:hover {"
		"    background-color: #e1e100;"  // 鼠标悬停时的背景色
		"}";
	cShowColor01.sButtenStyle2 = "QPushButton {"
		"    background-color: yellow;"  // 背景色 (黄色)
		"    color: black;"               // 文字颜色 (黑色)
		"    border: none;"               // 去掉边框
		"    padding: 10px;"              // 内边距
		"    border-radius: 15px;"         // 圆角
		"}"
		"QPushButton:hover {"
		"    background-color: #e1e100;"  // 鼠标悬停时的背景色
		"}";
	/**
	* @ Author: Gaojia
	* @ Description:   故障 状态1
	*/
	SShowColor cShowColor11;
	cShowColor11.cBackGround2 = cColorRed;
	cShowColor11.cText2 = cColorBlack;
	cShowColor11.cBackGround1 = cColorRed;
	cShowColor11.cText1 = cColorBlack;
	cShowColor11.sButtenStyle1 = "QPushButton {"
		"    background-color: red;"  // 背景色 (黄色)
		"    color: black;"               // 文字颜色 (黑色)
		"    border: none;"               // 去掉边框
		"    padding: 10px;"              // 内边距
		"    border-radius: 15px;"         // 圆角
		"}"
		"QPushButton:hover {"
		"    background-color: #e1e100;"  // 鼠标悬停时的背景色
		"}";
	cShowColor11.sButtenStyle2 = "QPushButton {"
		"    background-color: red;"  // 背景色 (黄色)
		"    color: black;"               // 文字颜色 (黑色)
		"    border: none;"               // 去掉边框
		"    padding: 10px;"              // 内边距
		"    border-radius: 15px;"         // 圆角
		"}"
		"QPushButton:hover {"
		"    background-color: #e1e100;"  // 鼠标悬停时的背景色
		"}";
	/**
	* @ Author: Gaojia
	* @ Description:   状态2
	*/
	SShowColor cShowColor2;
	cShowColor2.cBackGround2 = cColorGreen;
	cShowColor2.cText2 = cColorBlack;
	cShowColor2.cBackGround1 = cColorWrite;
	cShowColor2.cText1 = cColorBlack;
	cShowColor2.sButtenStyle1 = "QPushButton {"
		"    background-color: rgb(0,255,0);"  // 背景色 (黄色)
		"    color: black;"               // 文字颜色 (黑色)
		"    border: none;"               // 去掉边框
		"    padding: 10px;"              // 内边距
		"    border-radius: 15px;"         // 圆角
		"}"
		"QPushButton:hover {"
		"    background-color: #e1e100;"  // 鼠标悬停时的背景色
		"}";
	cShowColor2.sButtenStyle2 = "QPushButton {"
		"    background-color: white;"  // 背景色 (黄色)
		"    color: black;"               // 文字颜色 (黑色)
		"    border: none;"               // 去掉边框
		"    padding: 10px;"              // 内边距
		"    border-radius: 15px;"         // 圆角
		"}"
		"QPushButton:hover {"
		"    background-color: #e1e100;"  // 鼠标悬停时的背景色
		"}";
	/**
	* @ Author: Gaojia
	* @ Description:   工艺 状态3
	*/
	SShowColor cShowColor03;
	cShowColor03.cBackGround2 = cColorYellow;
	cShowColor03.cText2 = cColorBlack;
	cShowColor03.cBackGround1 = cColorWrite;
	cShowColor03.cText1 = cColorBlack;
	cShowColor03.sButtenStyle1 = "QPushButton {"
		"    background-color: yellow;"  // 背景色 (黄色)
		"    color: black;"               // 文字颜色 (黑色)
		"    border: none;"               // 去掉边框
		"    padding: 10px;"              // 内边距
		"    border-radius: 15px;"         // 圆角
		"}"
		"QPushButton:hover {"
		"    background-color: #e1e100;"  // 鼠标悬停时的背景色
		"}";
	cShowColor03.sButtenStyle2 = "QPushButton {"
		"    background-color: white;"  // 背景色 (黄色)
		"    color: black;"               // 文字颜色 (黑色)
		"    border: none;"               // 去掉边框
		"    padding: 10px;"              // 内边距
		"    border-radius: 15px;"         // 圆角
		"}"
		"QPushButton:hover {"
		"    background-color: #e1e100;"  // 鼠标悬停时的背景色
		"}";
	/**
	* @ Author: Gaojia
	* @ Description:   故障 状态3
	*/
	SShowColor cShowColor13;
	cShowColor13.cBackGround2 = cColorRed;
	cShowColor13.cText2 = cColorBlack;
	cShowColor13.cBackGround1 = cColorWrite;
	cShowColor13.cText1 = cColorBlack;
	cShowColor13.sButtenStyle1 = "QPushButton {"
		"    background-color: red;"  // 背景色 (黄色)
		"    color: black;"               // 文字颜色 (黑色)
		"    border: none;"               // 去掉边框
		"    padding: 10px;"              // 内边距
		"    border-radius: 15px;"         // 圆角
		"}"
		"QPushButton:hover {"
		"    background-color: #e1e100;"  // 鼠标悬停时的背景色
		"}";
	cShowColor13.sButtenStyle2 = "QPushButton {"
		"    background-color: white;"  // 背景色 (黄色)
		"    color: black;"               // 文字颜色 (黑色)
		"    border: none;"               // 去掉边框
		"    padding: 10px;"              // 内边距
		"    border-radius: 15px;"         // 圆角
		"}"
		"QPushButton:hover {"
		"    background-color: #e1e100;"  // 鼠标悬停时的背景色
		"}";
	QVector<SShowColor>vecTech;
	vecTech.push_back(cShowColor00);
	vecTech.push_back(cShowColor01);
	vecTech.push_back(cShowColor2);
	vecTech.push_back(cShowColor03);

	QVector<SShowColor>vecFauit;
	vecFauit.push_back(cShowColor00);
	vecFauit.push_back(cShowColor11);
	vecFauit.push_back(cShowColor2);
	vecFauit.push_back(cShowColor13);

	m_mapShowColor.insert(0, vecTech);
	m_mapShowColor.insert(1, vecFauit);
}



